﻿using System;
using System.Collections.Generic;

namespace ProjectIndieFarm
{
    public class ChallengeGroupPotato
    {
        public static void Setup(IChallengeSystem system)
        {
            var potato1 = system.Add(new GenericChallenge()
                .SetChallengeName("收获 1个土豆")
                .DisplayNameFactory(()=>$"收获第{ChallengeSystem.HarvestedCountPotato}/1个土豆")
                .OnCheckFinish(self => ChallengeSystem.HarvestedCountPotato > 0)
                .OnFinish(self =>
                {
                    Global.Coins.Value += 100;
                    self.SendMessageWithReward(100);
                }));
            var potato10 = system.Add(new GenericChallenge()
                .SetChallengeName("累计收获10个土豆")
                .DisplayNameFactory(() => $"累计收获{ChallengeSystem.HarvestedCountPotato}/10个土豆")
                .OnCheckFinish(self => ChallengeSystem.HarvestedCountPotato >= 10)
                .OnFinish(self =>
                {
                    Global.Coins.Value += 100;
                    self.SendMessageWithReward(100);
                }));
            var potato20 = system.Add(new GenericChallenge()
                .SetChallengeName("累计收获20个土豆")
                .DisplayNameFactory(() => $"累计收获{ChallengeSystem.HarvestedCountPotato}/20个土豆")
                .OnCheckFinish(self => ChallengeSystem.HarvestedCountPotato >= 20)
                .OnFinish(self =>
                {
                    Global.Coins.Value += 100;
                    self.SendMessageWithReward(100);
                }));
            var potato30 = system.Add(new GenericChallenge()
                .SetChallengeName("累计收获30个土豆")
                .DisplayNameFactory(() => $"累计收获{ChallengeSystem.HarvestedCountPotato}/30个土豆")
                .OnCheckFinish(self => ChallengeSystem.HarvestedCountPotato >= 30)
                .OnFinish(self =>
                {
                    Global.Coins.Value += 100;
                    self.SendMessageWithReward(100);
                }));
            var potato50 = system.Add(new GenericChallenge()
                .SetChallengeName("累计收获50个土豆")
                .DisplayNameFactory(() => $"累计收获{ChallengeSystem.HarvestedCountPotato}/50个土豆")
                .OnCheckFinish(self => ChallengeSystem.HarvestedCountPotato >= 50)
                .OnFinish(self =>
                {
                    Global.Coins.Value += 100;
                    Global.ShowCarrotSeedInShop.Value = true;
                    self.SendMessageWithRewardAndOther(100, "商店新增<color=orange>胡萝卜种子</color>");
                }));

        }
    }
}
